local lueshou = fk.CreateSkill{
  name = "wk_heg__lueshou",
}

local H = require "packages.ol_hegemony.util"
local HG = require "packages.new_heg_diy_my.util"

Fk:loadTranslationTable{
  ["wk_heg__lueshou"] = "略守",
  [":wk_heg__lueshou"] = "①当你响应其他角色使用的牌结算后，若你的<a href= ':Heg__policy'>“战策”</a>数小于你体力上限，你可获得一张<a href= ':Heg__policy'>“战策”</a>。②与你势力相同的角色手牌上限+1。",

  ["$wk_heg__lueshou1"] = "坚守此城，援军不日必至。",
  ["$wk_heg__lueshou2"] = "诸将无虑，大将军早有筹谋。",
}

local spec = {
  can_trigger = function(self, event, target, player, data)
    if not (player:hasSkill(lueshou.name) and HG.GetPolicyNum(player) < player.maxHp and player == target) then return false end
    return data.responseToEvent and data.responseToEvent.card and data.responseToEvent.from and data.responseToEvent.from ~= player
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    HG.GetPolicy(room, player, 1, self.name)
  end,
}

lueshou:addEffect(fk.CardUseFinished, spec)
lueshou:addEffect(fk.CardRespondFinished, spec)

lueshou:addEffect("maxcards", {
  correct_func = function (self, player)
    return table.find(Fk:currentRoom().alive_players, function (p)
      return H.compareKingdomWith(player, p) and p:hasShownSkill(lueshou.name)
    end) and 1 or 0
  end,
})

return lueshou